package com.open.capacity.recuritment.controller;

import com.open.capacity.common.model.SysUser;
import com.open.capacity.common.web.PageResult;
import com.open.capacity.common.web.Result;
import com.open.capacity.recuritment.Dto.RecruitmentDto;
import com.open.capacity.recuritment.service.IRecommendService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @description: 推荐
 * @date:2021/5/25 下午5:26
 * @author:jxy
 */
@RestController
@RequestMapping("/recommend")
public class RecommendController {
    @Resource
    private IRecommendService recommendService;

    @GetMapping("/findJobOffers")
    @ResponseBody
    public PageResult<RecruitmentDto> findJobOffers(@RequestParam Integer page, @RequestParam Integer limit) {
        Map<String, Object> map = new HashMap<>();
        map.put("page", page);
        map.put("limit", limit);
        PageResult<RecruitmentDto> list = recommendService.findJobOffers(map);
        return list;
    }

    /**
     * 查询待业人员
     *
     * @return
     */
    @GetMapping("/unemployed")
    public PageResult<SysUser> findAllUnemployed() {
        PageResult<SysUser> unemployed = recommendService.findAllUnemployed();
        return unemployed;
    }

    /**
     * 内推待业人员
     *
     * @return
     */
    @PostMapping("/push")
    public void pushUnemployed(@RequestBody Map<String, Object> map) {
      recommendService.pushUnemployed(map);
    }


}
